package com.lrkj.back.service.impl;

import java.util.List;
import java.util.Map;

import com.lrkj.back.entity.ZsDabao;
import com.lrkj.back.mapper.ZsDabaoMapper;
import com.lrkj.back.service.ZsDabaoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.com.cbons.mamisay.parent.db.api.DBInterface;
import cn.com.cbons.mamisay.parent.exception.DBException;
import cn.com.cbons.mamisay.parent.service.base.ParentServiceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Transactional
@Service("dabaoService")
public class ZsDabaoServiceImpl extends ParentServiceImpl<ZsDabao> implements ZsDabaoService {

    @Autowired
    private ZsDabaoMapper dabaoMapper;

    @Override
    protected DBInterface<ZsDabao> getDao() throws DBException {
        return dabaoMapper;
    }

    // 返回一个pageInfo的集合
    @Override
    public PageInfo<ZsDabao> findAllDabao(Map<String, Object> map) throws DBException {
        PageHelper.startPage(Integer.valueOf(map.get("pageNo").toString()),
                Integer.valueOf(map.get("pageSize").toString()));
        List<ZsDabao> tbList = dabaoMapper.findAllDabao(map);
        PageInfo<ZsDabao> page = new PageInfo<ZsDabao>(tbList);
        return page;
    }

    @Override
    public List<ZsDabao> findAllDabaoNoPage(Map<String, Object> map) throws DBException {
        return dabaoMapper.findAllDabao(map);
    }

    @Override
    public List<ZsDabao> selectAllDabao() throws DBException {
        return dabaoMapper.selectAllDabao();
    }

}
